Allocating
and Preparing MIDI Data Blocks
The midiOutLongMsg, midiInAddBuffer, and midiStreamOut functions require that
applications to allocate data blocks to pass to the device drivers for playback
or recording purposes. Each of these functions uses a MIDIHDR structure to describe its
data block.
Before you
use one of these functions to pass a data block to a device driver, you must
allocate memory for the buffer and the header structure that describes the data
block.
Windows
provides the following functions for preparing and cleaning up MIDI data
blocks:
|
midiInPrepareHeader |
Prepares a
MIDI input data block. |
|
midiInUnprepareHeader |
Cleans up
the preparation of a MIDI input data block. |
|
midiOutPrepareHeader |
Prepares a
MIDI output data block. |
|
midiOutUnprepareHeader |
Cleans up
the preparation of a MIDI output data block. |
Before you
pass a MIDI data block to a device driver, you must prepare the buffer by
passing it to the midiInPrepareHeader or midiOutPrepareHeader function. When the device
driver is finished with the buffer and returns it, you must clean up this
preparation by passing the buffer to the midiInUnprepareHeader or midiOutUnprepareHeader function before any
allocated memory can be freed.